import { Component } from '@angular/core';
import {NavController, NavParams } from 'ionic-angular';
import 'rxjs/add/operator/toPromise';
import  {YhxxPage} from '../yhxx/yhxx';
import {HttpServies} from '../../providers/http-servies';
import {HomePage} from "../home/home";



import { App } from 'ionic-angular';


@Component({
  selector: 'page-zhsz',
  templateUrl: 'zhsz.html',
  providers:[HttpServies]
})
export class ZhszPage {

  public  YhxxPage =YhxxPage;

 
  dataJson:any=[];

  ionViewDidLoad() {
    this.getInfo();
  }

  constructor(public navCtrl: NavController,private http:HttpServies, public navParams: NavParams,public app: App) {
  }
    /*
    * 账户设置跳转用户信息方法
    * */
  psdNewPage() {
this.navCtrl.push(YhxxPage);
  }
/*
* 账号信息加载
*
*
* */
  getInfo(){
    this.http.httpPost('/Home/human/sett')
        .then(res => {//成功
          if (res && res.code == 1) {
            console.log(res.msg);
            this.dataJson = res.data;
            // this.arryofkeys =Object.keys(this.dataJson);
          }else {
                this.http.showErro(res.msg);
          }
        })
  }

    /*
    *
    * 退出账户方法
    *
    *
    * */
  checkInfo(){
    this.http.httpPost('/Home/human/loginout')
        .then(res => {//成功
          if (res && res.code != 0) {
              localStorage.clear();
              this.http.showErro(res.msg);
              this.app.getRootNav().push(HomePage);
          }
        })
  }

}
